import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import postcssPresetEnv from 'postcss-preset-env'
import postcssPxtorem from 'postcss-pxtorem'
import {join} from 'path'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
  base: './', // 打包后的文件引用相对路径
  server: {
    port:818,
    host: '0.0.0.0' // 允许局域网访问调试
  },
  css:{
    postcss:{
      plugins:[
        postcssPresetEnv({stage:0}),
        postcssPxtorem({propList:['*']})
      ]
    }
  },
  resolve: {
    alias: {
      '@': join(__dirname, "src"),
    }
  }
})
